/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.dataInterface;

import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.acq.entity.breedinfo.AcqBreedInfo;
import com.thinkgem.jeesite.modules.acq.entity.dxdan.AcqDxdan;
import com.thinkgem.jeesite.modules.acq.entity.fammer.AcqFarmer;
import com.thinkgem.jeesite.modules.acq.entity.plantinfo.AcqPlantInfo;
import com.thinkgem.jeesite.modules.acq.service.dxdan.AcqDxdanService;
import com.thinkgem.jeesite.modules.acq.service.fammer.AcqFarmerService;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 农户接口
 * @author lj
 * @version 2018-3-20
 */
@Controller
@RequestMapping(value = "")
public class FammerController extends BaseController {
	@Autowired AcqFarmerService service;
	@Autowired AcqDxdanService dxdService;
	// 保存农户信息
	@RequestMapping(value = "saveFammer")
	@ResponseBody
	public Map<String,Object> saveFammer(AcqFarmer fammer  ,HttpServletRequest request, HttpServletResponse response, String id) {
		fammer.setCreateDate(new Date());
		return service.saveFammer(fammer);
	}
	
	//保存农户订单信息
	@RequestMapping(value = "saveDxdan")
	@ResponseBody
	public Map<String,Object> saveDxdan(AcqDxdan acqDxdan ,HttpServletRequest request, HttpServletResponse response, String id) {
		acqDxdan.setCreateDate(new Date());
		return dxdService.saveDxdan(acqDxdan);
	}
	
	//农户订销单列表
	@RequestMapping(value = "dxdanList")
	@ResponseBody
	public Map<String,Object> dxdanList(AcqDxdan acqDxdan ,HttpServletRequest request, HttpServletResponse response, String id) {
	
		return dxdService.dxdanList(acqDxdan);
	}
	
	//农户历史信息
	@RequestMapping(value = "history")
	@ResponseBody
	public Map<String,Object> history(AcqFarmer fammer ,HttpServletRequest request, HttpServletResponse response, String id) {
		//返回农户订销单信息，农户种植信息，农户养殖信息
		return service.history(fammer);
	}
	
	//调查员调查历史信息
	@RequestMapping(value = "historySeacher")
	@ResponseBody
	public Map<String,Object> historySeacher(User user,HttpServletRequest request, HttpServletResponse response, String id) {
		//返回农户订销单信息，农户种植信息，农户养殖信息
		return service.historySeacher(user);
	}
	//删除已提交历史
	@RequestMapping(value = "deleteHistory")
	@ResponseBody
	public Map<String,Object> deleteHistory(String id,HttpServletRequest request, HttpServletResponse response) {
		//返回农户订销单信息，农户种植信息，农户养殖信息
		return service.deleteHistory(id);
	}
	
	//保存养殖
	@RequestMapping(value = "updateHisBreed")
	@ResponseBody
	public Map<String,Object> saveBreed(AcqBreedInfo breed,HttpServletRequest request, HttpServletResponse response) {
		//保存养殖信息
		return service.saveBreed(breed);
	}
	
	//保存种植
	@RequestMapping(value = "updateHisPlant")
	@ResponseBody
	public Map<String,Object> savePlant(AcqPlantInfo plant,HttpServletRequest request, HttpServletResponse response) {
		//保存种植信息
		return service.savePlant(plant);
	}
	
	
	
	
	
	
	

	
	
	
	

}
